<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Additional informations on Zend_Currency - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.currency.additional.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.currency.additional.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.currency.exchange.html">Exchanging currencies</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.currency.html">Zend_Currency</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.html">Zend_Date</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.currency.additional" class="section"><div class="info"><h1 class="title">Additional informations on Zend_Currency</h1></div>
    

    <div class="section" id="zend.currency.additional.informations"><div class="info"><h1 class="title">Currency informations</h1></div>
        

        <p class="para">
            Sometimes it is necessary to get informations which are related to a currency.
            <span class="classname">Zend_Currency</span> provides you with several methods to get this
            informations. Available methods include the following:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getCurrencyList()</span></em>: Returns a list
                    of all currencies which are used in the given region as array. Defaults to the
                    objects locale when no region has been given.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getLocale()</span></em>: Returns the set
                    locale for the actual currency.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getName()</span></em>: Returns the full name
                    for the actual currency. When there is no full name available for the actual
                    currency, it will return the abbreviation for it.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getRegionList()</span></em>: Returns a list
                    of all regions where this currency is used as array. Defaults to the objects
                    currency when no currency has been given.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getService()</span></em>: Returns the set
                    exchange service object for the actual currency.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getShortName()</span></em>: Returns the
                    abbreviation for the actual currency.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getSymbol()</span></em>: Returns the currency
                    sign for the currency. When the currency has no symbol, then it will return the
                    abbreviation for it.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"> <span class="methodname">getValue()</span></em>: Returns the set
                    value for the actual currency.
                </p>
            </li>
        </ul>

        <p class="para">
            Let&#039;s see some code snippets as example:
        </p>

        <pre class="programlisting brush: php">
$currency = new Zend_Currency();

var_dump($currency-&gt;getValue());
// returns 0

var_dump($currency-&gt;getRegionList());
// could return an array with all regions where USD is used

var_dump($currency-&gt;getRegionList(&#039;EUR&#039;));
// returns an array with all regions where EUR is used

var_dump($currency-&gt;getName());
// could return &#039;US Dollar&#039;

var_dump($currency-&gt;getName(&#039;EUR&#039;));
// returns &#039;Euro&#039;
</pre>


        <p class="para">
            As you can see, several methods allow to use additional parameters to override the
            actual object to get informations for other currencies. Omitting this parameters will
            return informations from the actual set currency.
        </p>
    </div>

    <div class="section" id="zend.currency.additional.cache"><div class="info"><h1 class="title">Currency Performance Optimization</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Currency</span>&#039;s performance can be optimized using
            <span class="classname">Zend_Cache</span>. The static method
             <span class="methodname">Zend_Currency::setCache($cache)</span> accepts one option: a
            <span class="classname">Zend_Cache</span> adapter. If the cache adapter is set, the localization
            data which is used by <span class="classname">Zend_Currency</span> will be cached. Additionally
            there are some static methods for manipulating the cache:
             <span class="methodname">getCache()</span>,  <span class="methodname">hasCache()</span>,
             <span class="methodname">clearCache()</span> and  <span class="methodname">removeCache()</span>.
        </p>

        <div class="example" id="zend.currency.usage.cache.example"><div class="info"><p><b>Example #1 Caching currencies</b></p></div>
            

            <pre class="programlisting brush: php">
// creating a cache object
$cache = Zend_Cache::factory(&#039;Core&#039;,
                             &#039;File&#039;,
                             array(&#039;lifetime&#039; =&gt; 120,
                                   &#039;automatic_serialization&#039; =&gt; true),
                             array(&#039;cache_dir&#039;
                                       =&gt; dirname(__FILE__) . &#039;/_files/&#039;));
Zend_Currency::setCache($cache);
</pre>

        </div>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.currency.exchange.html">Exchanging currencies</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.currency.html">Zend_Currency</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.html">Zend_Date</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.currency.html">Zend_Currency</a></li>
  <li><a href="zend.currency.introduction.html">Introduction to Zend_Currency</a></li>
  <li><a href="zend.currency.usage.html">Using Zend_Currency</a></li>
  <li><a href="zend.currency.options.html">Options for currencies</a></li>
  <li><a href="zend.currency.description.html">What makes a currency?</a></li>
  <li><a href="zend.currency.position.html">Where is the currency?</a></li>
  <li><a href="zend.currency.number.html">How does the currency look like?</a></li>
  <li><a href="zend.currency.value.html">How much is my currency?</a></li>
  <li><a href="zend.currency.calculation.html">Calculating with currencies</a></li>
  <li><a href="zend.currency.exchange.html">Exchanging currencies</a></li>
  <li class="active"><a href="zend.currency.additional.html">Additional informations on Zend_Currency</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>